// redpackage


function redPackage(total, count, min){
    let remian = total
    let res = []

    for(let i = 0; i < count; i++){
        if(i === count - 1){
            res.push(remian.toFixed(2))
        } else {
            let remianCount = count - i - 1;
            let max = remian - (remianCount * min)
            let price = Math.random() * (max - min) + min
            res.push(price.toFixed(2))
            remian = remian - price
        }
    }
    return res;
}
console.log(redPackage(5, 5, 0.1))